package problems;

public class Euler009 extends AbstractEuler {

	private static int UPPER_BOUND = 999;
	
	@Override
	public Number calculate() {
		for (int a = 1; a <= UPPER_BOUND; a++) {
			for (int b = a + 1; b <= UPPER_BOUND; b++) {
				for (int c = b + 1; c <= UPPER_BOUND; c++) {
					if (a * a + b * b == c * c) {
						//System.out.println("triplet: {" + a + "," + b + "," + c + "}");
						if (a + b + c == 1000) {
							return a * b * c;
						}
					}
				}
			}
		}
		
		throw new Error("check your calculation!");
		
	}

	@Override
	protected Number getCorrectAnswer() {
		return 31875000;
	}
	
}
